<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Projekt_model extends CI_Model {
	
	function GetMissions($tid) {
		$q = $this->db->order_by('id asc')
					  ->where('id', $tid)
					  ->get('missions');
		return $q->result();
	}
	
	function GetAllMisions() {
		$q = $this->db->order_by('id asc')
					  ->get('missions');
		return $q->result();
	}
	
	function AddNote($data) {
		$this->db->Insert('notes', $data);
	
	}
	


	function AddAssignment($data) {	//tu nie je moc čo komentovať... 
		
		$this->db->query("INSERT INTO mission(content) VALUES ('$data') ");
	
	}

	function GetSolutions($mid) {
		

		$q = $this->db->order_by('time desc')
					  ->where('mid', $mid)
					  ->get('solutions');

		return $q->result();
	
	}

	function GetOneSolution($sid) {
		

		$q = $this->db->order_by('time desc')
					  ->where('id', $sid)
					  ->get('solutions');

		return $q->result();
	
	}	
	
	function add_eval() {
		/*
		$data = array(
			'text'=> $_POST['komentar'],
			'points'=> $_POST['hodnotenie']),
			);
		
		return $this->db->insert('results',$data);
		*/
		return $_POST['hodnotenie'];
	}
	
}